﻿using Kele.Activity.Models;
using Kele.Repository;
using System.Collections.Generic;
using System.Threading.Tasks;


namespace Kele.Activity.Service
{
    public partial class ActivityService
    {
        #region skin muisc

        //public async Task<List<Tag>> GetTagListAsync(string category)
        //{
        //    const string key = "activity_tag_list";
        //    var ret = await AppCache.CacheStrategy.GetAsync<IEnumerable<Tag>>(key);
        //    if (ret != null) return ret.Where(tag => tag.Category == category).ToList();

        //    await using var connection = ConnectionFactory();
        //    const string sql = " SELECT tag_id, name, category FROM kl_activity_tag;";
        //    ret = connection.Query<Tag>(sql);
        //    await AppCache.CacheStrategy.SetAsync(key, ret);
        //    return ret.Where(tag => tag.Category == category).ToList();
        //}

        public async Task<List<Skin>> GetSkinListAsync()
        {
            var tableName = AppReflection.GetTableName<Skin>();
            var cacheKey = AppCache.GetListKey(tableName);
            return await AppRepository.GetAsync<Skin>(null, tableName, cacheKey);
        }

        public async Task<List<Music>> GetMusicListAsync()
        {
            var tableName = AppReflection.GetTableName<Music>();
            var cacheKey = AppCache.GetListKey(tableName);
            return await AppRepository.GetAsync<Music>(null, tableName, cacheKey);

        }

        #endregion skin muisc

        public Dictionary<Activity_Record_Status, string> Activity_Record_status_Mapping =
            new Dictionary<Activity_Record_Status, string>
            {
                {Activity_Record_Status.free, "免费"},
                {Activity_Record_Status.paid, "已付款"},
                {Activity_Record_Status.refunded, "已退款"},
                {Activity_Record_Status.unpaid, "未付款"}
            };
    }
}